<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>AdminLTE | LogAnalysis</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- bootstrap 3.0.2 -->
    <link href="../static/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <!-- font Awesome -->
    <link href="../static/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <!-- Ionicons -->
    <link href="../static/css/ionicons.min.css" rel="stylesheet" type="text/css"/>
    <!-- Theme style -->
    <link href="../static/css/AdminLTE.css" rel="stylesheet" type="text/css"/>
    <style>
        .row1 {
            margin-right: 5px;
            margin-left: 5px;
            margin-top: 20px;
        }
    </style>
</head>
<body class="skin-blue">
<!-- header logo: style can be found in header.less -->
<header class="header">
    <a href="index.html" class="logo">
        <!-- Add the class icon to your logo image or logo icon to add the margining -->
        AdminLTE
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top" role="navigation">
        <!-- Sidebar toggle button-->
        <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">切换导航</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </a>
        <div class="navbar-right">
            <ul class="nav navbar-nav">
                <!-- User Account: style can be found in dropdown.less -->
                <li class="dropdown user user-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="glyphicon glyphicon-user"></i>
                        <span>个人中心<i class="caret"></i></span>
                    </a>
                    <ul class="dropdown-menu">
                        <!-- User image -->
                        <li class="user-header bg-light-blue">
                            <img src="../static/images/pers/rw1.png" class="img-circle" alt="User Image"/>
                            <p>
                                我
                            </p>
                        </li>
                        <!-- Menu Body -->
                        <li class="user-body">
                            <div class="col-xs-4 text-center">
                                <a href="/findManger">个人信息</a>
                            </div>
                            <div class="col-xs-4 text-center">
                                <a href="/findAllLogs">操作日志</a>
                            </div>
                            <div class="col-xs-4 text-center">
                                <a href="/login">退出登录</a>
                            </div>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>
</header>
<div class="wrapper row-offcanvas row-offcanvas-left">
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="left-side sidebar-offcanvas">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- Sidebar user panel -->
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="../static/img/pers/rw1.png" class="img-circle" alt="User Image"/>
                </div>
                <div class="pull-left info">
                    <p>你好，管理员</p>

                    <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
                </div>
            </div>
            <!-- search form -->
            <form action="#" method="get" class="sidebar-form">
                <div class="input-group">
                    <input type="text" name="search" class="form-control" placeholder="搜索..."/>
                    <span class="input-group-btn">
                                <button type='submit' name='searchtoUrl' id='search-btn' class="btn btn-flat"><i
                                        class="fa fa-search"></i></button>
                            </span>
                </div>
            </form>
            <!-- /.search form -->
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu">
                <li>
                    <a href="index.html">
                        <i class="fa fa-dashboard"></i> <span>首页</span>
                    </a>
                </li>
                <li class="treeview active">
                    <a href="#">
                        <i class="fa fa-bar-chart-o"></i>
                        <span>日志管理</span>
                        <i class="fa fa-angle-left pull-right"></i>
                    </a>
                    <ul class="treeview-menu">
                        <li><a href="/LogCatchPre"><i class="fa fa-angle-double-right"></i> 日志获取</a></li>
                        <li class="active"><a href="LogAnalysis.html"><i class="fa fa-angle-double-right"></i> 日志分析</a></li>
                        <li><a href="LogWarn.html"><i class="fa fa-angle-double-right"></i> 日志报警</a></li>
                    </ul>
                </li>
                <li class="treeview">
                    <a href="#">
                        <i class="fa fa-table"></i> <span>系统管理</span>
                        <i class="fa fa-angle-left pull-right"></i>
                    </a>
                    <ul class="treeview-menu">
                        <li><a href="/SysRightPre"><i class="fa fa-angle-double-right"></i> 权限管理</a></li>
                        <li><a href="/PersRightPre"><i class="fa fa-angle-double-right"></i> 人员管理</a></li>
                    </ul>
                </li>
                <li>
                    <a href="calendar.html">
                        <i class="fa fa-calendar"></i> <span>日历</span>

                    </a>
                </li>
                <li>
                    <a href="/findAllMailsInBox">
                        <i class="fa fa-envelope"></i> <span>邮箱</span>

                    </a>
                </li>
            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>
    <!-- Right side column. Contains the navbar and content of the page -->
    <aside class="right-side">
        <section class="content-header no-margin">
            <h1 class="text-center">
                日志可视化及分析
            </h1>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- interactive chart -->
                    <div class="box box-primary">

                        <div class="box-body">
                            <div id="interactive" style="height: 300px;"></div>
                        </div><!-- /.box-body-->
                    </div><!-- /.box -->

                </div><!-- /.col -->
            </div><!-- /.row -->
            <div class="row">
                <div class="col-xs-12">
                    <!-- interactive chart -->
                    <div class="box box-primary">

                        <div class="box-body">
                            <div id="interactive1" style="height: 300px;"></div>
                        </div><!-- /.box-body-->
                    </div><!-- /.box -->

                </div><!-- /.col -->
            </div><!-- /.row -->
            <div class="row">
                <div class="col-xs-12">
                    <!-- interactive chart -->
                    <div class="box box-primary">

                        <div class="box-body">
                            <div id="interactive2" style="height: 300px;"></div>
                        </div><!-- /.box-body-->
                    </div><!-- /.box -->

                </div><!-- /.col -->
            </div><!-- /.row -->
            <div class="content">
                <div class="input-group">
                    <form action="/findProblemDataLogs" method="get">
                        <input type="submit" class="btn-lg" style="margin-left: 450px;width: 500px" value="搜索异常日志数据"/>
                    </form>
                </div>
            </div><!-- /.content -->
            <!--<HR style="FILTER:alpha(opacity=100,finishopacity=0,style=3)" width="80%" color=#987cb9 SIZE=6>-->
            <HR>
            <div class="container1" id="container1" style="display: none" th:if="${problemData}!=null">
                <div class="row1 clearfix">
                    <div class="col-md-12 column">
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th >序号</th>
                                    <th >玩家游戏名</th>
                                    <th >嗑药次数</th>
                                    <th >平均每秒嗑药耗时</th>
                                    <th >超出阈值（%）</th>
                                    <th >严重程度</th>
                                    <th >描述</th>
                                    <th >时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="problemData:${problemData}">
                                    <td th:text="${problemData.id}"></td>
                                    <td th:text="${problemData.gamername}"></td>
                                    <td th:text="${problemData.mediCount}"></td>
                                    <td th:text="${problemData.avgtime}"></td>
                                    <td th:text="${problemData.overrate}"></td>
                                    <td th:text="${problemData.degree}"></td>
                                    <td th:text="${problemData.describe}"></td>
                                    <td th:text="${problemData.date}"></td>
                                    <td>
                                        <button class="btn btn-danger btn-xs" data-toggle="modal"
                                                data-target="#addWarnLog"
                                                th:onclick="saveWarn([[${problemData.id}]],[[${problemData.gamername}]],[[${problemData.degree}]],[[${problemData.describe}]])">另存为告警
                                        </button>
                                        <!--th:onclick="saveWarn([[${problemData.degree}]],[[${problemData.describe}]])"-->
                                        <!-- th:onclick="saveWarn([[${problemData.date}]],[[${problemData.degree}]],[[${problemData.describe}]])"-->
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            <div class="modal-footer no-margin-top">
                                <ul class="pagination pull-right no-margin">
                                    <!-- 首页 -->
                                    <li>
                                        <a th:href="'/findProblemDataLogs?pageNum=0'">首页</a>
                                    </li>
                                    <!-- 上一页 -->
                                    <li th:if="${problemData.hasPrevious()}">
                                        <a th:href="'/findProblemDataLogs?pageNum=' + ${problemData.previousPageable().getPageNumber()}"
                                           th:text="上一页"></a>
                                    </li>
                                    <!-- 中间页 -->
                                    <li th:each="pageNum:${#numbers.sequence(0, problemData.getTotalPages() - 1)}">
                                        <a th:href="'/findProblemDataLogs?pageNum=' + ${pageNum}" th:text="${pageNum + 1}"
                                           th:if="${pageNum ne problemData.pageable.getPageNumber()}"></a>
                                        <a th:href="'/findProblemDataLogs?pageNum=' + ${pageNum}" th:text="${pageNum + 1}"
                                           th:if="${pageNum eq problemData.pageable.getPageNumber()}"
                                           th:style="'font-weight:bold;background: #6faed9;'"></a>
                                    </li>
                                    <!-- 下一页 -->
                                    <li th:if="${problemData.hasNext()}">
                                        <a th:href="'/findProblemDataLogs?pageNum=' + ${problemData.nextPageable().getPageNumber()}"
                                           th:text="下一页"></a>
                                    </li>
                                    <!-- 尾页 -->
                                    <li>
                                        <a th:href="'/findProblemDataLogs?pageNum=' + ${problemData.getTotalPages() - 1}">尾页</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <section class="content">
                <div class="jumbotron" style="display: none" id="showmess">
                    <h1 style="text-align: center">无异常数据!</h1>
                </div>
            </section><!-- /.content -->
        </section><!-- /.content -->
    </aside><!-- /.right-side -->
</div><!-- ./wrapper -->
<div class="modal fade" id="addWarnLog" role="dialog" aria-labelledby="gridSystemModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="/addWarnLog" method="get" id="actform" >
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="gridSystemModalLabel">提示</h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" id="dateid" name="dateid" value=""/>
                    <input type="hidden" id="degree" name="degree" value=""/>
                    <input type="hidden" id="describe" name="describe" value=""/>
                    <input type="hidden" id="gamername" name="gamername" value=""/>
                    <div class="container-fluid">
                        确定要存为告警记录吗？
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-xs btn-white" data-dismiss="modal">取 消</button>
                    <button type="submit" class="btn btn-xs btn-green">确 定</button>
                </div>
            </form>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<script src="../static/js/right/jquery.min.js"></script>
<!-- jQuery 2.0.2 -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="../static/js/bootstrap.min.js" type="text/javascript"></script>
<!-- AdminLTE App -->
<script src="../static/js/AdminLTE/app.js" type="text/javascript"></script>

<script src="../static/js/echarts.min.js"></script>
<!-- Page script -->
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('interactive'));
    var myChart1 = echarts.init(document.getElementById('interactive1'));
    var myChart2 = echarts.init(document.getElementById('interactive2'));
    // 新建productName与nums数组来接受数据，因为我们
    var date = [];
    var newlogCount = [];
    var onlinePersCount = [];
    var waitLogCount = [];
    var acepLogCount = [];
    var solvedLogCount = [];
    //AJAX接收数据主体
    $.ajax({
        type: "GET",
        url: "/getdata",
        dataType: "json",
        async: false,
        success: function (result) {

            for (var i = 0; i < result.length; i++) {
                date.push(result[i].date);
                newlogCount.push(result[i].newlogCount);
                onlinePersCount.push(result[i].onlinePersCount);
                waitLogCount.push(result[i].waitLogCount);
                acepLogCount.push(result[i].acepLogCount);
                solvedLogCount.push(result[i].solvedLogCount);
            }

        },
        error: function (errorMsg) {
            alert("获取后台数据失败！");
        }
    });
    // 指定图表的配置项和数据
    var option = {
        title: {
            text: '近三天新增日志数量'
        },
        toolbox: {
            show: true,
            feature: {
                mark: {show: true},
                dataView: {show: true, readOnly: true},
                magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                restore: {show: true},
                saveAsImage: {}
            }
        },
        tooltip: {},
        legend: {
            data: ['新增日志数']
        },
        xAxis: {
            //结合
            data: date
        },
        yAxis: {},
        series: [{
            name: '日志数',
            type: 'line',
            smooth: true,
            //结合
            data: newlogCount
        }]
    };
    var option1 = {
        title: {
            text: '近三天在线人数'
        },
        toolbox: {
            show: true,
            feature: {
                mark: {show: true},
                dataView: {show: true, readOnly: true},
                magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                restore: {show: true},
                saveAsImage: {}
            }
        },
        tooltip: {},
        legend: {
            data: ['在线人数']
        },
        xAxis: {
            //结合
            data: date
        },
        yAxis: {},
        series: [{
            name: '在线人数',
            type: 'line',
            smooth: true,
            //结合
            data: onlinePersCount
        }]
    };
    var option2 = {
        title: {
            text: '近三天数据处理情况'
        },
        toolbox: {
            show: true,
            feature: {
                mark: {show: true},
                dataView: {show: true, readOnly: true},
                magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                restore: {show: true},
                saveAsImage: {}
            }
        },
        tooltip: {},
        legend: {
            data: ['待接收', '已接收', '已处理']
        },
        xAxis: {
            //结合
            data: date
        },
        yAxis: {},
        series: [
            {
                name: '待接收',
                type: 'line',
                smooth: false,
                stack: '总量',
                itemStyle: {normal: {areaStyle: {type: 'default'}}},
                data: waitLogCount
            },
            {
                name: '已接收',
                type: 'line',
                stack: '总量',
                smooth: true,
                itemStyle: {normal: {areaStyle: {type: 'default'}}},
                data: acepLogCount
            },
            {
                name: '已处理',
                type: 'line',
                stack: '总量',
                smooth: true,
                itemStyle: {normal: {areaStyle: {type: 'default'}}},
                data: solvedLogCount
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    myChart1.setOption(option1);
    myChart2.setOption(option2);
</script>
<script type="text/javascript">
    $(document).ready(function () {
        if ([[${session?.size}]] !== null) {
            $("#container1").css("display", "block");
        } else {
            $("#showmess").css("display", "block");
        }
    });
    function saveWarn(ID,GAMERNAME,DEGREE,DESCRIBE) {
        $("#dateid").val(ID);
        $("#gamername").val(GAMERNAME);
        $("#degree").val(DEGREE);
        $("#describe").val(DESCRIBE);
    }
    function getUrl() {
        const myurl = '/addWarnLog';
        $("#actform").attr("action", myurl);
    }
</script>
</body>
</html>